package star;

import java.util.Arrays;
import java.util.Scanner;

public class StarSorter {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Star[] stars = new Star[20];

        for (int i = 0; i < stars.length; i++) {
            System.out.println("Enter name, volume, and distance for star " + (i + 1) + ":");
            String name = scanner.next();
            int vol = scanner.nextInt();
            int dist = scanner.nextInt();
            stars[i] = new Star(name, vol, dist);
            scanner.nextLine(); // 读取行尾的换行符
        }

        Arrays.sort(stars);

        for (Star star : stars) {
            System.out.println(star);
        }

        scanner.close();
    }
}
